home *** CD-ROM | disk | FTP | other *** search
- on setMode
- global mode, searchSuccessFul
- if (mode = "index") or not searchSuccessFul then
- setIndexMode()
- else
- if mode = "search" then
- setSearchMode()
- end if
- end if
- end
-
- on setIndexMode
- global browserTopLine, indexButton, searchButton, browserTopics, numVisibleTopics, findButton, mode, masterBrowserTopics
- set mode to "index"
- if isEnabled(indexButton) then
- enableButton(searchButton)
- activateButtonKeepActivated(indexButton)
- disableUserTyping()
- clearSearchTopicField()
- disableTopicButtons()
- disableButton(findButton)
- updateStage()
- set browserTopLine to 1
- set browserTopics to the text of cast "browserTopics"
- set masterBrowserTopics to browserTopics
- setFieldText("browser", browserTopLine, numVisibleTopics, browserTopics)
- setSearchSuccessFul(0)
- clearDatabase()
- end if
- end
-
- on setSearchMode
- global indexButton, searchButton, inputField, findButton, mode
- set mode to "search"
- if isEnabled(searchButton) then
- enableButton(indexButton)
- activateButtonKeepActivated(searchButton)
- enableButton(findButton)
- disableTopicButtons()
- clearDatabase()
- enableUserTyping()
- setClearedFlag(0)
- end if
- end
-
- on disableUserTyping
- global inputField
- set the editableText of sprite inputField to 0
- set the keyDownScript to "displayKeyLineAtTop"
- set the keyUpScript to EMPTY
- end
-
- on enableUserTyping
- global inputField
- set the keyDownScript to EMPTY
- set the keyUpScript to "checkReturnKey"
- set the editableText of sprite inputField to 1
- end
-
- on checkReturnKey
- if the key = RETURN then
- hilite char 1 to 32000 of field "searchTopic"
- doFind(the text of cast "searchTopic")
- end if
- end
-
- on clearDatabase
- global textSprite, clearedFlag, printButton
- if not clearedFlag then
- set the castNum of sprite textSprite to the number of cast "Empty Text"
- clearTitle()
- unhiliteClickedTopic()
- removeMoreButtons()
- disableButton(printButton)
- setButtonCursor(0, printButton)
- updateStage()
- setClearedFlag(1)
- end if
- end
-
- on setClearedFlag val
- global clearedFlag
- set clearedFlag to val
- end
-
- on enableTopicButtons
- global pictureButton, textButton, mapButton, printButton
- enableButton(pictureButton)
- enableButton(textButton)
- enableButton(mapButton)
- enableButton(printButton)
- end
-
- on disableTopicButtons
- global pictureButton, textButton, mapButton, printButton
- disableButton(pictureButton)
- disableButton(textButton)
- disableButton(mapButton)
- disableButton(printButton)
- end
-
- on clearSearchTopicField
- put EMPTY into field "searchTopic"
- end
-